<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>产品需求详情</title>
    <link href="../css/list-detial.css" type="text/css" rel="stylesheet"/>
</head>
<body>


<!--header-->
<header id="header" class="header">
    <div class="header-info left"><i></i><a href="pm-need-list-mems.html">产品需求列表</a>&nbsp;>&nbsp;产品需求详情</div>
        <div class="right-user right">
             <div class="clear t" >             <div id="headusername" class="role"></div>             <div class="icon"></div>         </div>
            <div class="head-down">
                <ul><li><a href="edit-pwd.html">修改密码</a></li><li><a onclick="loginOut()">退出系统</a></li></ul></div><div>
        </div>
    </div>
</header>
<!--menu-->
<aside id="aside" class="aside">
    <div class="logo">运营平台</div>
    <ul class="menu" id="asidemenu">
    </ul>
</aside>

<!--content-->
<div class="content">
    <div class="page-inner">
        <div class="page-content">
            <div class="table-head clear"><div class="left document-name" id="document-name"><i class="bug-i"></i></div><div class="right edit" id="editNeed"><a onclick="edit()" class="sure">编辑</a></div></div>
            <div class="table-cont">
                <table class="content-table">
                    <tr>
                        <td>需求名称：</td>
                        <td id="needName" colspan="3">合同到期提醒</td>
                    </tr>
                    <tr>
                        <td>类别：</td>
                        <td id="typeList"></td>
                        <td>产品:</td>
                        <td id="productList"></td>
                    </tr>
                    <tr>
                        <td>使用平台：</td>
                        <td id="platformList"></td>
                        <td>功能模块：</td>
                        <td id="functionList"></td>
                    </tr>

                    <tr>
                        <td>优先级：</td>
                        <td id="priority"></td>
                        <td>计划版本：</td>
                        <td id="version"></td>
                    </tr>
                    <tr>
                        <td>处理状态：</td>
                        <td id="status"></td>
                        <td>预计工时：</td>
                        <td id="expectWorkhour"></td>
                    </tr>
                    <tr>
                        <td>简述：</td>
                        <td colspan="3" id="discribe"></td>
                    </tr>

                    <tr class="area">
                        <td>方案思路：</td>
                        <td colspan="3" id="solution">
                            
                        </td>
                    </tr>
                    <tr class="area">
                        <td>附件：</td>
                        <td colspan="3">
                             <ul class="addAttachmentList" id="addAttachmentList">
                            </ul>
                        </td>
                    </tr>

                </table>
            </div>

            <div class="table-head clear"><div class="left document-name"><i class="bug-i"></i>相关原始需求</div></div>
            <div class="table-cont">
                <table class="relative-list">
                    <thead>
                        <tr>
                            <th>来源</th>
                            <th>需求名称</th>
                            <th>需求信息</th>
                            <th>提出人</th>
                            <th>处理状态</th>
                           
                        </tr>
                    <thead>
                     <tbody id="relativeList">
                       
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
<script src="../js/jquery.min.js"></script>
<script src="../js/jquery.cookie.js"></script>
<script src="../js/common.js"></script>

<script type="text/javascript">

    var _id = getUrlId();
    
    function edit(){
        location.href = 'pm-need-detail-pm-edit.html?id='+_id;
    }
    //权限控制
    var roleid = $.cookie('userrole');
    if(roleid == 1 || roleid == 2 || roleid == 3){
        $('#editNeed').remove()
    }
    var attachment = new attachment();
    function updata(){
        var url  = _ip+'/product/getRequireById?callback=update&id='+_id;
        $.ajax({
            url:url,
            type: 'GET',
            dataType: 'jsonp',
            contentType:'application/json',
            jsonpCallback: 'update',
            success:function(data){
                if(data.success){
                    var data = data.data;
                    $('#document-name').append('ID.'+data.id)
                    $('#needName').html(data.name);
                    $('#typeList').html(data.type);
                    $('#productList').html(data.product);
                    $('#platformList').html(data.plat);
                    $('#functionList').html(data.feature);
                    $('#priority').html(data.priority)
                    $('#version').html(data.version);
                    $('#status').html(data.status);
                    $('#discribe').html(data.discribe);
                    $('#solution').html(data.solution);
                    $('#expectWorkhour').html( data.expectWorkhour==null?'': data.expectWorkhour + ' 小时');
                    if(data.attachment){
                        attachment.init({
                            addAttachmentList:$('#addAttachmentList'),
                            isDetail:true
                        }).getAttachmentList(data.attachment.split(',')); 
                    }

                }else{
             /*       alert('获取失败, 请稍后重试！');*/
                }
            }
        })
    }
    updata();

    getRelativList();
    function getRelativList(){
        var url  = _ip+'/requireRelation/getRequireRelationByPid?pid='+_id;        
        $.ajax({
            url:url,
            type: 'GET',
            dataType: 'jsonp',
            contentType:'application/json',
            jsonpCallback: 'off',
            success:function(data){
                var data = data.data;
                var h = '';

                for(var k = 0; k < data.length; k++){
                    h += '<tr><td>'+data[k].pName+'</td>';
                        h += '<td>'+data[k].requireName+'</td>';
                        h += '<td><a href="pm-need-detail-mems.html?id='+data[k].oId+'">'+( data[k].productName + '&nbsp;|&nbsp;' + data[k].feature+ '&nbsp;|&nbsp;' +(data[k].name || '')    )+'</a></td>';
                        h += '<td>'+data[k].creater+'</td>';
                        h += '<td>'+data[k].status+'</td>';
                }
                $('#relativeList').html(h);
            }
        })
    }
    
</script>
</body>
</html>